OpenTofu Infrastructure
OpenTofu modules and environment configurations for provisioning the SRE platform's cloud infrastructure. OpenTofu is a fully open-source (MPL 2.0) fork of Terraform with identical HCL syntax and provider compatibility.
See OpenTofu patterns for coding conventions.
Structure
tofu/
βββ modules/ # Reusable, provider-agnostic modules
β βββ compute/ # VM instances for RKE2 nodes
β βββ network/ # VPC, subnets, security groups
β βββ dns/ # DNS zone and record management
β βββ load-balancer/ # L4 load balancer for K8s API and Istio ingress
β βββ storage/ # Object storage (S3-compatible) for backups, logs, state
βββ environments/ # Per-environment compositions
β βββ dev/
β βββ staging/
β βββ production/
βββ scripts/ # Helper scripts (state backend init, etc.)
Usage
task infra-plan ENV=dev # Preview changes
task infra-apply ENV=dev # Apply changes
Key Rules
- Pin exact provider versions in
versions.tf(no>=or~>) - Never store state locally β use S3-compatible remote backend with locking
- Never commit secrets in
.tfvarsβ useTF_VAR_env vars - Tag all resources with
Project,Environment,ManagedBy,Compliance - Run
tofu fmtbefore every commit